/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package main;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
import java.io.IOException;

/**
 * @author Monster
 */
public class GameDesign {
    
    //<editor-fold defaultstate="collapsed" desc=" Generated Fields ">//GEN-BEGIN:|fields|0|
    private Image quangcanh;
    private TiledLayer base;
    private TiledLayer VatCan;
    private Image bomb;
    private Sprite bom;
    public int bomseq001Delay = 350;
    public int[] bomseq001 = {0, 1, 2, 3, 4, 5};
    private Sprite Monster01;
    public int Monster01_downDelay = 200;
    public int[] Monster01_down = {3, 4, 5, 4};
    public int Monster01_upDelay = 200;
    public int[] Monster01_up = {9, 10, 11, 10};
    public int Monster01_diedDelay = 200;
    public int[] Monster01_died = {12, 13, 14, 15};
    public int Monster01_leftDelay = 200;
    public int[] Monster01_left = {6, 7, 8, 7};
    public int Monster01_rightDelay = 200;
    public int[] Monster01_right = {0, 1, 2, 1};
    private Image enemies01;
    private Image Gach_chay;
    private Image fire;
    private Sprite BomNo;
    public int BomNoseq001Delay = 200;
    public int[] BomNoseq001 = {0, 1, 2, 3, 0};
    private Sprite BombMan;
    public int BombMan_upDelay = 200;
    public int[] BombMan_up = {7, 8, 9, 10};
    public int BombMan_downDelay = 200;
    public int[] BombMan_down = {35, 36, 37, 38};
    public int BombMan_rightDelay = 200;
    public int[] BombMan_right = {14, 15, 16, 17};
    public int BombMan_leftDelay = 200;
    public int[] BombMan_left = {21, 22, 23, 24};
    public int BombMan_injuredDelay = 200;
    public int[] BombMan_injured = {28, 29, 30};
    public int BombMan_diedDelay = 200;
    public int[] BombMan_died = {0, 2, 3, 4, 5, 6};
    private Image bomberman;
    private Image Gach;
    private TiledLayer ground;
    private Sprite brick;
    public int normalDelay = 200;
    public int[] normal = {1};
    public int firedDelay = 200;
    public int[] fired = {0, 2, 3, 5, 7, 9, 11};
    //</editor-fold>//GEN-END:|fields|0|

    //<editor-fold defaultstate="collapsed" desc=" Generated Methods ">//GEN-BEGIN:|methods|0|
    //</editor-fold>//GEN-END:|methods|0|

    public Image getQuangcanh() throws java.io.IOException {//GEN-BEGIN:|1-getter|0|1-preInit
        if (quangcanh == null) {//GEN-END:|1-getter|0|1-preInit
            // write pre-init user code here
            quangcanh = Image.createImage("/res/canhvat/quangcanh.png");//GEN-BEGIN:|1-getter|1|1-postInit
        }//GEN-END:|1-getter|1|1-postInit
        // write post-init user code here
        return this.quangcanh;//GEN-BEGIN:|1-getter|2|
    }
//GEN-END:|1-getter|2|

    public TiledLayer getBase() throws java.io.IOException {//GEN-BEGIN:|2-getter|0|2-preInit
        if (base == null) {//GEN-END:|2-getter|0|2-preInit
            // write pre-init user code here
            base = new TiledLayer(20, 17, getQuangcanh(), 30, 30);//GEN-BEGIN:|2-getter|1|2-midInit
            int[][] tiles = {
                { 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27 },
                { 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35 },
                { 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35 },
                { 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35 },
                { 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35 },
                { 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35 },
                { 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35 },
                { 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35 },
                { 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35 },
                { 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35 },
                { 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35 },
                { 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35 },
                { 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35 },
                { 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35 },
                { 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35 },
                { 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35 },
                { 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 43 }
            };//GEN-END:|2-getter|1|2-midInit
            // write mid-init user code here
            for (int row = 0; row < 17; row++) {//GEN-BEGIN:|2-getter|2|2-postInit
                for (int col = 0; col < 20; col++) {
                    base.setCell(col, row, tiles[row][col]);
                }
            }
        }//GEN-END:|2-getter|2|2-postInit
        // write post-init user code here
        return base;//GEN-BEGIN:|2-getter|3|
    }
//GEN-END:|2-getter|3|

    public TiledLayer getVatCan() throws java.io.IOException {//GEN-BEGIN:|3-getter|0|3-preInit
        if (VatCan == null) {//GEN-END:|3-getter|0|3-preInit
            // write pre-init user code here
            VatCan = new TiledLayer(20, 17, getQuangcanh(), 30, 30);//GEN-BEGIN:|3-getter|1|3-midInit
            int[][] tiles = {
                { 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27 },
                { 33, 21, 21, 20, 8, 12, 21, 12, 34, 7, 21, 12, 107, 16, 4, 7, 21, 12, 12, 35 },
                { 33, 34, 13, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 13, 34, 35 },
                { 33, 21, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 8, 35 },
                { 33, 34, 17, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 0, 17, 21, 35 },
                { 33, 8, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 20, 35 },
                { 33, 21, 17, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 0, 17, 6, 35 },
                { 33, 6, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 34, 35 },
                { 33, 7, 17, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 0, 17, 6, 35 },
                { 33, 6, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 34, 35 },
                { 33, 34, 17, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 0, 17, 12, 35 },
                { 33, 8, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 12, 35 },
                { 33, 34, 17, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 0, 17, 8, 35 },
                { 33, 21, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 21, 35 },
                { 33, 34, 13, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 13, 21, 35 },
                { 33, 39, 34, 30, 31, 8, 34, 34, 7, 21, 34, 7, 46, 21, 21, 21, 8, 21, 12, 35 },
                { 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 43 }
            };//GEN-END:|3-getter|1|3-midInit
            // write mid-init user code here
            for (int row = 0; row < 17; row++) {//GEN-BEGIN:|3-getter|2|3-postInit
                for (int col = 0; col < 20; col++) {
                    VatCan.setCell(col, row, tiles[row][col]);
                }
            }
        }//GEN-END:|3-getter|2|3-postInit
        // write post-init user code here
        return VatCan;//GEN-BEGIN:|3-getter|3|
    }
//GEN-END:|3-getter|3|

    public void updateLayerManagerForScene01(LayerManager lm) throws java.io.IOException {//GEN-LINE:|4-updateLayerManager|0|4-preUpdate
        // write pre-update user code here
        getVatCan().setPosition(0, 0);//GEN-BEGIN:|4-updateLayerManager|1|4-postUpdate
        getVatCan().setVisible(true);
        lm.append(getVatCan());
        getBase().setPosition(0, 0);
        getBase().setVisible(true);
        lm.append(getBase());
        getGround().setPosition(0, 0);
        getGround().setVisible(true);
        lm.append(getGround());//GEN-END:|4-updateLayerManager|1|4-postUpdate
        // write post-update user code here
    }//GEN-BEGIN:|4-updateLayerManager|2|
//GEN-END:|4-updateLayerManager|2|

    public Image getBomb() throws java.io.IOException {//GEN-BEGIN:|17-getter|0|17-preInit
        if (bomb == null) {//GEN-END:|17-getter|0|17-preInit
            // write pre-init user code here
            bomb = Image.createImage("/res/bomb/bomb.png");//GEN-BEGIN:|17-getter|1|17-postInit
        }//GEN-END:|17-getter|1|17-postInit

        return this.bomb;//GEN-BEGIN:|17-getter|2|
    }
//GEN-END:|17-getter|2|

    public Sprite getBom() throws java.io.IOException {                                   
        Sprite bom = new Sprite(getBomb(), 30, 30);//GEN-BEGIN:|18-getter|1|18-postInit
        bom.setFrameSequence(bomseq001);//GEN-END:|18-getter|1|18-postInit
        return bom;
    }

    public Image getGach_chay() throws java.io.IOException {//GEN-BEGIN:|20-getter|0|20-preInit
        if (Gach_chay == null) {//GEN-END:|20-getter|0|20-preInit
            // write pre-init user code here
            Gach_chay = Image.createImage("/res/Gach/Gach_chay.png");//GEN-BEGIN:|20-getter|1|20-postInit
        }//GEN-END:|20-getter|1|20-postInit
        // write post-init user code here
        return this.Gach_chay;//GEN-BEGIN:|20-getter|2|
    }
//GEN-END:|20-getter|2|



    public Image getFire() throws java.io.IOException {//GEN-BEGIN:|23-getter|0|23-preInit
        if (fire == null) {//GEN-END:|23-getter|0|23-preInit
            // write pre-init user code here
            fire = Image.createImage("/res/bomb/fire.png");//GEN-BEGIN:|23-getter|1|23-postInit
        }//GEN-END:|23-getter|1|23-postInit
        // write post-init user code here
        return this.fire;//GEN-BEGIN:|23-getter|2|
    }
//GEN-END:|23-getter|2|

    public Sprite getBomNo() throws java.io.IOException {//GEN-BEGIN:|24-getter|0|24-preInit
        //if (BomNo == null) {//GEN-END:|24-getter|0|24-preInit
            // write pre-init user code here
          //  BomNo = new Sprite(getFire(), 90, 90);//GEN-BEGIN:|24-getter|1|24-postInit
          //  BomNo.setFrameSequence(BomNoseq001);//GEN-END:|24-getter|1|24-postInit
            // write post-init user code here
       // }//GEN-BEGIN:|24-getter|2|
		Sprite BomNo = new Sprite(getFire(), 90, 90);//GEN-BEGIN:|24-getter|1|24-postInit
        BomNo.setFrameSequence(BomNoseq001);
        return BomNo;
    }
//GEN-END:|24-getter|2|

    public Image getBomberman() throws java.io.IOException {//GEN-BEGIN:|26-getter|0|26-preInit
        if (bomberman == null) {//GEN-END:|26-getter|0|26-preInit
            // write pre-init user code here
            bomberman = Image.createImage("/res/boomman/bomberman.png");//GEN-BEGIN:|26-getter|1|26-postInit
        }//GEN-END:|26-getter|1|26-postInit
        // write post-init user code here
        return this.bomberman;//GEN-BEGIN:|26-getter|2|
    }
//GEN-END:|26-getter|2|

    public Sprite getBombMan() throws java.io.IOException {//GEN-BEGIN:|27-getter|0|27-preInit
        if (BombMan == null) {//GEN-END:|27-getter|0|27-preInit
            // write pre-init user code here
            BombMan = new Sprite(getBomberman(), 30, 30);//GEN-BEGIN:|27-getter|1|27-postInit
            BombMan.setFrameSequence(BombMan_down);//GEN-END:|27-getter|1|27-postInit
            // write post-init user code here
        }//GEN-BEGIN:|27-getter|2|
        return BombMan;
    }
//GEN-END:|27-getter|2|

    public TiledLayer getGround() throws java.io.IOException {//GEN-BEGIN:|34-getter|0|34-preInit
        if (ground == null) {//GEN-END:|34-getter|0|34-preInit
            // write pre-init user code here
            ground = new TiledLayer(20, 17, getQuangcanh(), 30, 30);//GEN-BEGIN:|34-getter|1|34-midInit
            int[][] tiles = {
                { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
                { 1, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 1 },
                { 1, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 1 },
                { 1, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 1 },
                { 1, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 1 },
                { 1, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 1 },
                { 1, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 1 },
                { 1, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 1 },
                { 1, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 1 },
                { 1, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 1 },
                { 1, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 1 },
                { 1, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 1 },
                { 1, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 1 },
                { 1, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 1 },
                { 1, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 1 },
                { 1, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 1 },
                { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
            };//GEN-END:|34-getter|1|34-midInit
            // write mid-init user code here
            for (int row = 0; row < 17; row++) {//GEN-BEGIN:|34-getter|2|34-postInit
                for (int col = 0; col < 20; col++) {
                    ground.setCell(col, row, tiles[row][col]);
                }
            }
        }//GEN-END:|34-getter|2|34-postInit
        // write post-init user code here
        return ground;//GEN-BEGIN:|34-getter|3|
    }
//GEN-END:|34-getter|3|

    public Image getEnemies01() throws java.io.IOException {//GEN-BEGIN:|80-getter|0|80-preInit
        if (enemies01 == null) {//GEN-END:|80-getter|0|80-preInit
            // write pre-init user code here
            enemies01 = Image.createImage("/res/enemies/enemies01.png");//GEN-BEGIN:|80-getter|1|80-postInit
        }//GEN-END:|80-getter|1|80-postInit
        // write post-init user code here
        return this.enemies01;//GEN-BEGIN:|80-getter|2|
    }
//GEN-END:|80-getter|2|

    public Sprite getMonster01() throws java.io.IOException {                                   
        Sprite Monster01 = new Sprite(getEnemies01(), 30, 30);//GEN-BEGIN:|81-getter|1|81-postInit
        Monster01.setFrameSequence(Monster01_down);//GEN-END:|81-getter|1|81-postInit
        return Monster01;
    }
                       

    public Image getGach() throws java.io.IOException {//GEN-BEGIN:|88-getter|0|88-preInit
        if (Gach == null) {//GEN-END:|88-getter|0|88-preInit
            // write pre-init user code here
            Gach = Image.createImage("/res/Gach/Gach.png");//GEN-BEGIN:|88-getter|1|88-postInit
        }//GEN-END:|88-getter|1|88-postInit
        // write post-init user code here
        return this.Gach;//GEN-BEGIN:|88-getter|2|
    }
//GEN-END:|88-getter|2|
//GEN-LINE:|81-getter|1|
//GEN-LINE:|81-getter|0|81-preInit
//GEN-LINE:|81-getter|2|
    public Sprite getBrick() throws java.io.IOException {//GEN-LINE:|94-getter|1|94-postInit
            Sprite brick = new Sprite(getGach_chay(), 30, 30);
            brick.setFrameSequence(normal);
        return brick;
    }
                       


    
}
